import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import User from '@/views/user/Users'
import Right from '@/views/right/Rights'
import Role from '@/views/right/Roles'
import Categories from '@/views/goods/Categories'
import Goods from '@/views/goods/Goods'
import List from '@/views/goods/List'
import Add from '@/views/goods/Add'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: {name: 'Login'}
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {path: 'users', name: 'User', component: User},
        {path: 'rights', name: 'Right', component: Right},
        {path: 'roles', name: 'Role', component: Role},
        {path: 'categories', name: 'Categories', component: Categories},
        {
          path: 'goods',
          name: 'Goods',
          component: Goods,
          redirect: {
            name: 'List'
          },
          children: [
            { path: 'list', name: 'List', component: List },
            { path: 'add', name: 'Add', component: Add }
          ]
        }
      ]
    }
  ]
})
